<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "Agent".
 *
 * @property string $id
 * @property string $username
 * @property string $password_hash
 * @property string $auth_key
 * @property string $nickname
 * @property string $address
 * @property string $mobile
 * @property integer $level
 * @property integer $parent_id
 * @property string $role
 * @property string $status
 * @property string $email
 * @property string $created_at
 * @property string $updated_at
 * @property string $company_name
 * @property string $contacts
 * @property string $contacts_mobile
 */
class Agent extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'Agent';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['password_hash', 'auth_key', 'address', 'email'], 'required'],
            [['level', 'parent_id', 'created_at', 'updated_at'], 'integer'],
            [['username', 'password_hash', 'auth_key', 'nickname', 'role', 'status', 'email', 'contacts'], 'string', 'max' => 64],
            [['address'], 'string', 'max' => 255],
            [['mobile', 'contacts_mobile'], 'string', 'max' => 11],
            [['company_name'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'username' => 'Username',
            'password_hash' => 'Password Hash',
            'auth_key' => 'Auth Key',
            'nickname' => 'Nickname',
            'address' => 'Address',
            'mobile' => 'Mobile',
            'level' => 'Level',
            'parent_id' => 'Parent ID',
            'role' => 'Role',
            'status' => 'Status',
            'email' => 'Email',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'company_name' => 'Company Name',
            'contacts' => 'Contacts',
            'contacts_mobile' => 'Contacts Mobile',
        ];
    }

    /**
     * @inheritdoc
     * @return AgentQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new AgentQuery(get_called_class());
    }
}
